#include "stdafx.h"
#include "NetCard.h"
#include "NetCardList.h"

EnumList NetCardList;

HRESULT InitNetCardList()
{
    HRESULT hr;

    EnumItem *item;
    NetCardList.head = item = new EnumItem;
    if (item == NULL)
    {
        NetCardList.Release();
        return E_OUTOFMEMORY;
    }
    item->data.vt = VT_DISPATCH;
    item->data.pdispVal = new NetCard;
    if (item->data.pdispVal == NULL)
    {
        NetCardList.Release();
        return E_OUTOFMEMORY;
    }
    hr = ((NetCard *)item->data.pdispVal)->SetName(L"Net Card 1");
    if (FAILED(hr))
    {
        NetCardList.Release();
        return hr;
    }
    hr = ((NetCard *)item->data.pdispVal)->SetAddress(L"12-34-56-78-90-AB");
    if (FAILED(hr))
    {
        NetCardList.Release();
        return hr;
    }
    item->next = NULL;

    return S_OK;
}
